package com.idol.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * @author Supreme_Sir
 * @version 1.0
 * @className ResumeController
 * @description
 * @date 2020/11/1 19:02
 **/
@Controller
public class LoginController {

    @RequestMapping("index")
    public String login(HttpSession session, String user, String password) {
        if ("admin".equals(user) && "admin".equals(password)) {
            session.setAttribute("permission", true);
            return "redirect:resume/all";
        }
        return "login";
    }

    @RequestMapping("logout")
    public String logout(HttpSession session) {
        session.invalidate();
        return "login";
    }
}
